package com.mef.smsplat.web.servlet;

import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.mef.smsplat.service.AirportInfoService;
import com.mef.smsplat.service.CacheService;
import com.mef.smsplat.util.ApplicationContextUtil;
import com.mef.smsplat.util.Constants;

/**
 * 系统初始化的工作在init()方法中
 * @author hc24
 *
 */
public class InitServlet extends HttpServlet {
	private static final Log logger=LogFactory.getLog(InitServlet.class);
	
	public void init() throws ServletException {
		ServletContext sc=getServletContext();
		String ctx=sc.getContextPath();
		sc.setAttribute("ctx", ctx);//应用上下文
		sc.setAttribute("constant", new Constants());//全局静态变量

		CacheService cacheService = (CacheService) ApplicationContextUtil.getContext().getBean("cacheService");
		cacheService.initCache();
	}
	
	public void destroy() {
		super.destroy();		
	}

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

	}

}
